{% extends "base_generic.html" %}

{% block title %}Register - Local Library{% endblock %}

{% block content %}
<div class="row justify-content-center">
  <div class="col-md-6">
    <div class="card">
      <div class="card-header">
        <h3 class="text-center mb-0"><i class="bi bi-person-plus"></i> Create Account</h3>
      </div>
      <div class="card-body">
        <form method="post">
          {% csrf_token %}
          
          {% if form.non_field_errors %}
            <div class="alert alert-danger">
              {{ form.non_field_errors }}
            </div>
          {% endif %}
          
          <div class="mb-3">
            <label for="{{ form.username.id_for_label }}" class="form-label">Username</label>
            {{ form.username }}
            {% if form.username.errors %}
              <div class="text-danger">{{ form.username.errors }}</div>
            {% endif %}
          </div>
          
          <div class="row">
            <div class="col-md-6">
              <div class="mb-3">
                <label for="{{ form.first_name.id_for_label }}" class="form-label">First Name</label>
                {{ form.first_name }}
                {% if form.first_name.errors %}
                  <div class="text-danger">{{ form.first_name.errors }}</div>
                {% endif %}
              </div>
            </div>
            <div class="col-md-6">
              <div class="mb-3">
                <label for="{{ form.last_name.id_for_label }}" class="form-label">Last Name</label>
                {{ form.last_name }}
                {% if form.last_name.errors %}
                  <div class="text-danger">{{ form.last_name.errors }}</div>
                {% endif %}
              </div>
            </div>
          </div>
          
          <div class="mb-3">
            <label for="{{ form.email.id_for_label }}" class="form-label">Email</label>
            {{ form.email }}
            {% if form.email.errors %}
              <div class="text-danger">{{ form.email.errors }}</div>
            {% endif %}
          </div>
          
          <div class="mb-3">
            <label for="{{ form.password1.id_for_label }}" class="form-label">Password</label>
            {{ form.password1 }}
            {% if form.password1.errors %}
              <div class="text-danger">{{ form.password1.errors }}</div>
            {% endif %}
          </div>
          
          <div class="mb-3">
            <label for="{{ form.password2.id_for_label }}" class="form-label">Confirm Password</label>
            {{ form.password2 }}
            {% if form.password2.errors %}
              <div class="text-danger">{{ form.password2.errors }}</div>
            {% endif %}
          </div>
          
          <div class="d-grid">
            <button type="submit" class="btn btn-primary">
              <i class="bi bi-person-plus"></i> Create Account
            </button>
          </div>
        </form>
        
        <hr>
        <div class="text-center">
          <p class="mb-0">Already have an account? <a href="{% url 'login' %}">Login here</a></p>
        </div>
      </div>
    </div>
  </div>
</div>
{% endblock %} 